#coding:utf-8
#@Author AChan
#@Description   测试例子 使用numpy   库


import numpy as np
import csv
from datetime import datetime

import pandas as pa

from matplotlib import pyplot as plt

csvFiles = "/home/jack/download/peking/advertist_category.csv"

with open(csvFiles) as f:
    reader = csv.reader(f)
    header_row = next(reader)
    dates, highs, lows = [], [], []
    for rows in reader:
        # current_date = datetime.strptime(row[0], '%Y-%m-%d')
        row = str(rows[0]).split(';')
        dates.append(row[2])
        hign = int(row[0])
        highs.append(hign)
        low = int(row[4])
        lows.append(low)


fig=plt.figure(dpi=128,figsize=(10,6))
plt.plot(dates,highs,c='red',alpha=0.5)#实参alpha指定颜色的透明度，0表示完全透明，1（默认值）完全不透明
plt.plot(dates,lows,c='blue',alpha=0.5)
plt.fill_between(dates,highs,lows,facecolor='blue',alpha=0.1) #给图表区域填充颜色
plt.title('advertist_category',fontsize=24)
plt.xlabel('',fontsize=16)
plt.ylabel('Temperature(F)',fontsize=16)
plt.tick_params(axis='both',which='major',labelsize=16)
fig.autofmt_xdate()  #绘制斜的日期标签
plt.show()

# dataset = pa.read_csv('%s' % csvFiles)

# x = dataset.values

# for y in x:
#     print(y)


exit(0)